Returns a string that represents the hexadecimal value of a number.
与えられた数値を 16 進数にした文字列を返します。
Hex (Number)
Hex (Number)
String
文字列
Number: Any numeric expression that you want to convert to a hexadecimal number.
Number: 16 進数にする数値を示す表式。
Sub ExampleHex
Sub ExampleHex
REM uses BasicFormulas in Office Calc
REM Office Calc タイプの関数を再現
Dim a2, b2, c2 as String
Dim a2, b2, c2 as String
a2 = "&H3E8"
a2 = "&H3E8"
b2 = Hex2Int(a2)
b2 = Hex2Int(a2)
MsgBox b2
MsgBox b2
c2 = Int2Hex(b2)
c2 = Int2Hex(b2)
MsgBox c2
MsgBox c2
End Sub
End Sub
Function Hex2Int( sHex As String ) As Long
Function Hex2Int( sHex As String ) As Long
REM Returns a Long-Integer from a hexadecimal value.
REM 16 進数値をロング整数に換算して返す
Hex2Int = clng( sHex )
Hex2Int = clng( sHex )
End Function
End Function
Function Int2Hex( iLong As Long) As String
Function Int2Hex( iLong As Long) As String
REM Calculates a hexadecimal value in Integer.
REM 整数値を 16 進数値に換算
Int2Hex = "&H" & Hex( iLong )
Int2Hex = "&H" & Hex( iLong )
End Function
End Function